package me.gacl.mapping;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import me.gacl.domain.User;

public interface UserMapperI {
	
	//使用@insert注解指明add方法要执行的sql
	@Insert("insert into users (name, age) values (#{name}, #{age})")
	public int add(User user);
	
	//使用@Delete注解指明deleteById方法要执行的SQL
	@Delete("delete from users where id = #{id}")
	public void deleteById(int id);
	
	//使用@Update注解指明update方法要执行的sql
	@Update("update users set name = #{name}, age = #{age} where id = #{id}")
	public void update(User user);
	
	//使用@Select注解指明select方法要执行的sql
	@Select("select * from users where id = #{id}")
	public User getById(int id);
	
	//使用@select注解指明getAll方法要执行的sql
	@Select("select * from users")
	public List<User> getAllUser();
}
